$(function(){
	var overFileSize = $("#overFileSize").val();
	if(overFileSize){
		alertMsg("文件大小不能超过13KB，请重新上传！");
	}
});
function submitForm(){
	/**解决console未定义的问题*/
	if (!window.console || !console.firebug){
		var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
		window.console = {};
		for (var i = 0; i < names.length; ++i)
		window.console[names[i]] = function(){} 
	} 
	console.log("disabled");
	var file=$("#file").val();
	if(trimAllSpace(file) == "")
	{
		 alertMsg("请上传文件！");
		 return false;
	}
	var pattern= new RegExp("\.(txt)$");
	if(!pattern.test(file.toLowerCase())){
		   alertMsg("文件只支持txt格式！");
		   return false;
	}
	$(".btnd_a").attr("disabled","disabled");
	popload("contact/waitLoading","loading_con");
	return true;
}

function changeGroup(){
	$("#groupId").val($("#targetGroup").val());
	var groupMaxNum =$("#groupMaxNum").val();
	$.ajax({
		   type: "POST",
		   url: "contact/contactsByGroupId",
		   data:{
		   		groupId:$("#groupId").val()
		   },
		   success: function(data){
		   var last=groupMaxNum-data.contacts;
	   	   $("#importRemind").html("文件只支持txt格式（大小不能超过35KB，记录数不能超过"+groupMaxNum+"条），每行一个条记录；<br />记录格式可以为“手机号码”或“手机号码,姓名”（以英文逗号分隔，姓名最长10个字符）；<br />现已有"+data.contacts+"个联系人，还可导入"+last+"个联系人。");
	   	   }
		});
}
//导入等待
function popload(popHtmlName, divClassName){
	$.get(
		popHtmlName,
		{},
		function (data){
			$("div").remove("." + divClassName);
			$(data).appendTo("body");
		},
		"html"
	);
}